19. Hardware Related Commands > 19.9 AT^SRADC   Configure and Read ADC Measurement

19.9
AT^SRADC   Configure and Read ADC Measurement
The AT^SRADC configures the parameters required for ADC measurement (Analog-to-Digital Converter) and returns the measurement result(s). The value(s) can be delivered once on request by using the single measure­ment mode, or periodically by specifying the measurement interval.

Note that the TC65 Module uses an unbalanced input with two pins, while the TC65 Terminal has a balanced input with four pins. This requires different pin names as listed below. See also [2] and [3].
First ADC channel of TC65 Module: ADC1_IN.
Second ADC channel of TC65 Module: ADC2_IN.
First ADC channel of TC65 Terminal: ADC1_IN_P and ADC1_IN_N
Second ADC channel of TC65 Terminal: ADC2_IN_P and ADC2_IN_N

Another major difference between both products is that the TC65 Terminal requires the measured ADC voltages to be recalculated. For detail see parameter <value> below as well as the AT^SAADC command.
Syntax
Test Command  
Response(s)
^SRADC:(list of supported <ch>s), (list of supported <oc>s), (list of supported <it>s)
Read Command  
Response(s)
Write Command  
Response(s)
Write Command  
Response(s)
Reference(s) 
PIN 
ASC0 
ASC1 
USB 
MUX1 
MUX2 
MUX3 
Charge 
Last 

 
Unsolicited Result Code
URC indicating the used channel, the number of measured samples and the voltage. Applies only if periodic measurement mode is enabled.
^SRADC: <ch>, <count>, <value>[, <value>[, <value>[, <value>[, <value>[, <value>[, <value>[, <value>[, <value>[, <value>[, <value>]]]]]]]]]]

Parameter Description
 
<ch>(num)
Select ADC channel
0
First ADC channel
(ADC1_IN at TC65 Module.ADC1_IN_P and ADC1_IN_N at TC65 Terminal.)
1
Second ADC channel
(ADC2_IN at TC65 Module.ADC2_IN_P and ADC2_IN_N at TC65 Terminal.)
 
<oc>(num)
Open or close ADC channel
[0]
Close ADC channel specified with <ch>
1
Open ADC channel specified with <ch>
 
<it>(num)
Measurement interval
[0]
Single measurement mode
100...30,000
Output interval in ms at steps of 60/13 ms to enable periodic measurement mode.
 
<value>(num)
Measurement value
-25...+2425
Measured voltage in mV
Resolution: 1mV for TC65 Module resp. 2.083mV for TC65 Terminal
Accuracy (typ.): 2mV for TC65 Module resp. 4mV for TC65 Terminal

The captured value is the actual voltage applied at the ADCx_IN input. No fur­ther calculation is required.
However, in the case of the TC65 Terminal, the captured value is a raw value. The exact voltage measured at the ADCx_IN_P and ADCx_IN_N inputs needs to be recalculated using the values obtained with AT^SAADC. See AT^SAADC for detail.
 
<count>(num)
1...11
Number of measured samples
In single measurement mode: <count> is always 1.
In periodic measurement mode: <count> is number of <value>s indicated by each URC "^SRADC". The higher the sample rate set with <it>, the more mea­sured values are reported within the URC "^SRADC".


 
Notes
•
If power saving is enabled with AT+CFUN, take into account that the periodic mode lets the ME consume cur­rent each time the measurement is performed. This reduces the effect of power saving and thus decreases the operation time.
•
If an AT command is input on the same interface where the periodic measurement mode is on, up to 5 "^SRADC" URCs are queued up and sent after AT command completion.
If more than 5 URCs occur before the AT command is completed their measurement values are lost. In this case, one additional URC with a negative <count> and the single value "32767" is sent along with the first 5 buffered URCs. The negative <count> indicates the number of lost measurement values (not the number of URCs). See example below.

Examples

EXAMPLE 1


Single measurement
 
EXAMPLE 2


Periodic measurement at low sample rate (5s):
 
Start periodic measurement mode on the first ADC channel. Samples are taken every 5s. Every 5s the URC "^SRADC" appears to report the measured volt­ages. The second parameter represents the number of measured samples, in this case only one.
EXAMPLE 3


Periodic measurement at high sample rate (250ms):
 
Start periodic measurement on the first ADC chan­nel. Samples are taken every 250ms. Every second a URC "^SRADC" appears to report the measured voltage. The number of samples is 4 or 5.
EXAMPLE 4


Handling of "^SRADC" URCs and AT command execution on the same interface:
 
Start periodic measurement mode on the first ADC channel. Samples are taken every 250ms.
5 URCs were buffered during command input and sent after completion, another 2 URCs are lost.